package HTMLParser.HTMLTag;
import Parser.Token;

/**
 * This class simply represents a TextLayout tag. These tags are all something to
 * do will affecting the displayed information rather than representing anything
 * that is actually displayed.
 * @author Nathan Scully
 * @version FINAL
 */
public class TextLayout extends Tag
{

    /**
     * Constructor for the Table class. Takes one variable which is a Token
     * representing the HTML Tag (example: <B>). It will then create a Node and
     * set the type afterwards.
     * @param t A Token representing a TextLayout tag.
     */
    public TextLayout (Token t)
    {
        super(t,"");
        this.setType(findType(t));
    }

    /**
     * This method looks at the tag fromt the Token object and derives a String
     * reperesenting the token's type, which will be used with the Node object
     * created in the Constructor.
     * @param t The token from which the type is derived.
     * @return The type that the Node should be set to.
     */
    private String findType(Token t)
    {
        if(t.getToken().toLowerCase().equals("b")) return "Bold";
        if(t.getToken().toLowerCase().equals("i")) return "Italic";
        if(t.getToken().toLowerCase().equals("u")) return "Underlined";
        if(t.getToken().toLowerCase().equals("p")) return "P";
        if(t.getToken().toLowerCase().equals("br")) return "BR";
        if(t.getToken().toLowerCase().equals("blockquote")) return "blockquote";
        if(t.getToken().toLowerCase().equals("title")) return "title";
        if(t.getToken().toLowerCase().equals("dt")) return "dt";
        if(t.getToken().toLowerCase().equals("dl")) return "dl";
        if(t.getToken().toLowerCase().equals("dd")) return "dd";
        if(t.getToken().toLowerCase().equals("h1")) return "h1";
        if(t.getToken().toLowerCase().equals("h2")) return "h2";
        if(t.getToken().toLowerCase().equals("h3")) return "h3";
        if(t.getToken().toLowerCase().equals("pre")) return "pre";
        return "";
    }
}
